<?php

namespace common\models\bill;

use Yii;

/**
 * This is the model class for table "{{%bill_type}}".
 *
 * @property int $id
 * @property string $name 类型名称
 * @property string $description 类型备注
 * @property int $quantity 类型业务办理时需写入的RFID数量
 * @property int $company_id 所属单位ID
 * @property int $listorder 显示排序
 * @property int $status 状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 * @property int $deleted_at 删除时间
 */
class BillType extends \common\db\ActiveRecord {

    const STATUS_DEFAULT = 0;
    const STATUS_ACTIVE = 10;

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%bill_type}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['name'], 'required'],
            [['quantity', 'company_id', 'listorder', 'status', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['name'], 'string', 'max' => 50],
            [['description'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'name' => '类型名称',
            'description' => '类型备注',
            'quantity' => '类型业务办理时需写入的RFID数量',
            'company_id' => '所属单位ID',
            'listorder' => '显示排序',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
            'deleted_at' => '删除时间',
        ];
    }

    public function getParams() {
        return $this->hasMany(BillTypeField::className(), ['type_id' => 'id']);
    }

}
